home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / pmake / lst / RCS / lstMember.c,v < prev    next >
Encoding:
Text File  |  1992-05-19  |  1.4 KB  |  72 lines

  1. head     1.5;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.5
  10. date     88.11.17.20.53.32;  author adam;  state Exp;
  11. branches ;
  12. next     ;
  13.  
  14.  
  15. desc
  16. @@
  17.  
  18.  
  19.  
  20. 1.5
  21. log
  22. @checked in with -k by kupfer at 92.05.18.17.32.43.
  23. @
  24. text
  25. @/*-
  26.  * lstMember.c --
  27.  *    See if a given datum is on a given list.
  28.  *
  29.  * Copyright (c) 1988 by the Regents of the University of California
  30.  * Copyright (c) 1988 by Adam de Boor
  31.  *
  32.  * Permission to use, copy, modify, and distribute this
  33.  * software and its documentation for any purpose and without
  34.  * fee is hereby granted, provided that the above copyright
  35.  * notice appears in all copies.  The University of California nor
  36.  * Adam de Boor makes any representations about the suitability of this
  37.  * software for any purpose.  It is provided "as is" without
  38.  * express or implied warranty.
  39.  *
  40.  *
  41.  */
  42. #ifndef lint
  43. static char *rcsid =
  44. "$Id: lstMember.c,v 1.5 88/11/17 20:53:32 adam Exp $ SPRITE (Berkeley)";
  45. #endif lint
  46.  
  47. #include    "lstInt.h"
  48.  
  49. LstNode
  50. Lst_Member (l, d)
  51.     Lst                  l;
  52.     ClientData          d;
  53. {
  54.     List              list = (List) l;
  55.     register ListNode    lNode;
  56.  
  57.     lNode = list->firstPtr;
  58.     if (lNode == NilListNode) {
  59.     return NILLNODE;
  60.     }
  61.     
  62.     do {
  63.     if (lNode->datum == d) {
  64.         return (LstNode)lNode;
  65.     }
  66.     lNode = lNode->nextPtr;
  67.     } while (lNode != NilListNode && lNode != list->firstPtr);
  68.  
  69.     return NILLNODE;
  70. }
  71. @
  72.